package org.bitterorange.flansmodslain.listeners;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import mcheli.event.AircraftDestoryEvent;
import org.bitterorange.flansmodslain.models.BukkitVehicleDestroyEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class AircraftDestroyListener {
    @Mod.EventHandler
    @SubscribeEvent
    public void onAircraftDestroy(AircraftDestoryEvent event) {
        Player player = Bukkit.getPlayer(event.getAttackerName());
        if(player != null && event.getVehicleName() != null) {
            Bukkit.getServer().getPluginManager().callEvent(new BukkitVehicleDestroyEvent(player, event.getVehicleName()));
        }
    }
}
